#include <cstdio>
#include <cstring>

#define MAXN 50+5

int N, M;
int x1, y1, x2, y2;
long DP[MAXN][MAXN];

long VAL(int x, int y) {
	if (x<x1 || y<1 || x>x2 || y>N) return 0;
	if (x==x1 && y==y1) return 1;
	return DP[x][y];
}

int main() {
	scanf("%d%d", &N, &M);
	scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
	for (int x=x1; x<=x2; x++) {
		for (int y=1; y<=N; y++) {
			DP[x][y] += VAL(x-1, y-2) + VAL(x-1, y+2) + VAL(x-2, y-1) + VAL(x-2, y+1);
		}
	}
	printf("%ld\n", DP[x2][y2]);
	return 0;
}
